package com.daxiong.pattern.factory;

/**
 * 具体工厂
 *
 * @author sunyanxiong
 * @date 2017/4/23
 */
public class ConcreteCreator implements Creator {
    public <T extends Product> T factory(Class<T> c) {
        Product product = null;
        try {
            product = (Product) Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return (T) product;
    }
}
